<?php
/**
 * 套餐模型
 */

namespace app\common\model;

use think\model\concern\SoftDelete;

class Meal extends CommonBaseModel {
	use SoftDelete;
	// 自定义选择数据
	public const CATE_TEXT = [0 => '小学', 1 => '初中'];
	protected $name = 'meal';
	protected $autoWriteTimestamp = true;

	// 可搜索字段
	public array $searchField = ['name'];

	// 可作为条件的字段
	public array $whereField = ['tag', 'cate'];

	// 可作为多选条件的字段
	public array $multiWhereField = [];

	// 可做为时间
	public array $timeField = ['create_time'];

	protected $json = ['detail'];
	protected $jsonAssoc = true;
	public function getCateTextAttr($value, $data): string {
		return self::CATE_TEXT[$data['cate']];
	}
}
